<%-- 
    Document   : newarea
    Created on : Oct 16, 2011, 10:43:32 PM
    Author     : VIC
--%>
<%--
    Tham số hệ thống
newarea  areainfo   areaname   areamsg  save
order    status     action  search
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@page import="java.util.*, Beans.ThamSoHT, Models.ThamSoHT_Model"%>
<!--
Danh sách các tham số hệ thống ở trang này :
order      areainfo     areamsg     status      arealang
newarea    areaname     save        action      arealist
enable     disable      search
-->
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'checksubmitmsg', 'area', 'rightmsg', 'areainfo','areaname','areamsg','order','save','status','arealist', 'enable', 'disable', 'notice', 'areaexist', 'all' "; // chuỗi chứa các mã tham số của trang này.
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.

            String all = mdsts[0].getTenTS();
            String area = mdsts[1].getTenTS();
            String areaexist = mdsts[2].getTenTS();
            String areainfo = mdsts[3].getTenTS();
            String arealist = mdsts[4].getTenTS();
            String areamsg = mdsts[5].getTenTS();
            String areaname = mdsts[6].getTenTS();
            String checksubmitmsg = mdsts[7].getTenTS();
            String disable = mdsts[8].getTenTS();
            String enable = mdsts[9].getTenTS();
            String notice = mdsts[10].getTenTS();
            String order = mdsts[11].getTenTS();
            String rightmsg = mdsts[12].getTenTS();
            String save = mdsts[13].getTenTS();
            String status = mdsts[14].getTenTS();

            String msgright = notice + "/" + rightmsg;
            String msgchecksubmit = notice + "/" + checksubmitmsg;
            String msg = notice + "/" + areaexist;
            Vector v = (Vector) request.getAttribute("DSKV");

            int numpage = 0;// khởi tạo số trang = 0
            int vsize = v.size();
            if (vsize % 7 == 0) // mỗi trang có 6 dòng
            {
                numpage = vsize / 7;
            } else {
                numpage = vsize / 7 + 1;
            }
            String xx = (String) request.getAttribute("item"); // trang hiện tại đang xem
            int item = Integer.parseInt(xx);
%>

<h1><img style=" margin-top: 6px; margin-right: 13px; opacity: 0.8;" alt="" src="../images/area11.png"><%=area%></h1>
<div class="cb"></div>
<div class="bloc left">
    <div class="title">
        <%=areainfo%>        
    </div>
    <div class="content" style=" padding-top: 25px;">
        <form name="addArea" action="">
            <div style=" float: left; width: 120px;"><%=areaname%></div>
            <input type="text" style=" width: 200px;" class="text" name="areaname"/>
            <input style="margin-left: 20px" alt="<%=msg%>" class="button" id="<%=msgright%>" lang="<%=msgchecksubmit%>"  onclick="CreateArea(this.alt, this.id, this.lang);" type="button" value="<%=save%>" /><br/><br/><br/>
            <label><%=areamsg%></label>
        </form>
    </div>
</div>
<div id="DSKV" class="bloc right" style=" min-height: 153px;">
    <div class="title">
        <%=arealist%>        
    </div>
    <div class="content">
        <form name="dskhuvuc" action="">
            <table class="mytable" border="0" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width: 10%;  "><%=order%></th>
                        <th style="width: 18%; ">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>"   name="1" onclick="SortTenKV(this.className, this.name, this.lang)">
                                <div style="float:left"><%=areaname%></div>
                                <div id="sortkv1" style=" margin-right: 55px;" class="down1"></div>
                            </a>
                        </th>
                        <th style="width: 20%; margin-top: 2px;">
                            <a href="#" id="titledskv2" class="down"  name="1" lang="<%=msgright%>" onclick="SortTTKV(this.className, this.name, this.lang)">
                                <div><%=status%></div>
                                <div >
                                    <div id="sortkv2" class="down2"></div>
                                    <div id="sortkv2" class="up2" style="display:none;"></div>
                                </div>
                            </a>
                        </th>
                    </tr>
                    <tr id="searchTenKV">
                        <th><img style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" lang="<%=msgright%>" alt="1" src="../images/search1.png" onclick="SearchKV(this.alt, this.lang)"></th>
                        <th><input type="textbox" style="width: 120px;" class="text" name="TENKV" alt="1" size="17" lang="<%=msgright%>" ></th>
                        <th>
                            <div>
                                <select  class="select" id="1" name="TINHTRANG" lang="<%=msgright%>" onchange="SearchKV(this.id, this.lang)">
                                    <option value="all"><%=all%></option>
                                    <option value="1"><%=enable%></option>
                                    <option value="0"><%=disable%></option>
                                </select>
                            </div>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <%
                                for (int i = (item - 1) * 7; i < (item - 1) * 7 + 7 && i < vsize; i++) {
                                    Beans.KhuVuc kv = (Beans.KhuVuc) v.elementAt(i);
                    %>
                    <tr>
                        <td class="STT"><%= i + 1%></td>
                        <td class="TenKV"><a href="#" name="<%=kv.getMaKV()%>" lang="<%=msgright%>" onclick="ShowLangKV(this.name, this.lang)"><%= kv.getTenKV()%></a></td>
                        <td>
                            <select  class="<%= kv.getMaKV()%>" lang="<%=msgright%>" onchange="UpdateStatusKV(this.value,  this.className, this.lang)">
                                <%
                                                                    if (kv.getTinhTrang() == 1) {%>
                                <option value="1"><%= enable%></option>
                                <option value="0"><%= disable%></option>
                                <%  } else {%>
                                <option value="0"><%= disable%></option>
                                <option value="1"><%= enable%></option>
                                <%  }
                                %>
                            </select>
                        </td>
                    </tr>
                    <%  }
                    %>
                </tbody>
            </table>
            <div class="pagination" style=" margin-top: 20px;">
                <%
                            int trang = 1;
                            if (item > 1) {
                                trang = item - 1;
                            }
                %>
                <%
                            if (vsize > 7) {%>
                <a href="#" class="prev"  name="<%= trang%>" lang="<%=msgright%>" onclick="NewArea( this.name, this.lang)">«</a>
                <%      for (int c = 1; c <= numpage; c++) {
                                                    if (c != item) {
                %>              <a href="#"  name="<%= c%>" lang="<%=msgright%>" onclick="NewArea( this.name, this.lang)" ><%= c%></a>
                <%          } else {%><a class="current"> <%= c%></a> <% }
                                                }
                %>
                <%      if (item + 1 <= numpage) {
                                                    trang = item + 1;
                                                } else {
                                                    trang = item;
                                                }
                %>
                <a href="#" class="next"  name="<%= trang%>" lang="<%=msgright%>" onclick="NewArea( this.name, this.lang)">»</a>
                <%  }
                %>
            </div>
        </form>
    </div>
</div>
<div id="arealang" style=" width: 49%; overflow: hidden; " >
</div>

